<?php

namespace addons\filewatcher\controller;

use think\addons\Controller;
use think\Response;

class Index extends Controller
{

    public function index()
    {
        $this->error("当前插件暂无前台页面");
    }

    /**
     * Websocket客户端
     */
    public function client()
    {
        $config = get_addon_config('filewatcher');
        $config['excludepage'] = array_filter(explode("\n", str_replace(["\r\n", "\r"], "\n", str_replace("\\", "/", $config['excludepage']))));
        $js = $this->view->fetch(ADDON_PATH . 'filewatcher/view/index/client.js', ['config' => $config]);
        $response = Response::create($js, "", 200, ['Content-Type' => 'application/javascript']);
        return $response;
    }

}
